import fileIconMap from '@/assets/js/FileIconMap';

const getFileIcon = (filePath) => {
  if(typeof filePath !== 'string') {
    return fileIconMap.get('plain');
  }

  let fileNameSplit = filePath.split('.');
  let suffix = fileNameSplit[fileNameSplit.length - 1];

  if(fileNameSplit.length === 1) suffix = 'plain';

  return fileIconMap.get(suffix) || fileIconMap.get('plain');
}

export default getFileIcon;